package com.zhy.generator.codegen.mybatis.javahelper.elements;
import com.zhy.generator.codegen.dom.java.CompilationUnit;
import com.zhy.generator.codegen.dom.java.FullyQualifiedJavaType;
import com.zhy.generator.codegen.dom.java.TopLevelClass;
import com.zhy.generator.codegen.mybatis.AbstractJavaGenerator;
import com.zhy.generator.config.Configuration;
import com.zhy.generator.config.ConfigurationConstant;

import java.util.List;

import static cn.hutool.core.util.StrUtil.isNotBlank;

/**
 * @author 源
 */
public abstract class AbstractJavaHelperMethodGenerator extends AbstractJavaGenerator {
    public abstract void addHelperElements(TopLevelClass tlc);
    public abstract String getMethodStr();

    protected FullyQualifiedJavaType getSuperClass() {

        Configuration configuration = context.getConfiguration(ConfigurationConstant.CONFIGURATION_PO);
        if (configuration == null) {
            return null;
        }
        String rootClass = configuration.getRootClass();
        if (isNotBlank(rootClass)) {
            FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(rootClass);
            return fqjt;
        }

        return null;
    }

    @Override
    public List<CompilationUnit> getCompilationUnits() {
        return null;
    }
}
